Skip to content

fix(id): document lifecycle and align rebind expiry - #5646

Merged
dezren39 merged 2 commits into
mainfrom
queue/9326-5048-hosted-binding-audit
Nov 5, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/9326-5048-hosted-binding-audit

Conversation

@dezren39

@dezren39 dezren39 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Add a module-header transition table for the public HostedBindingService methods and record dispositions (a)–(d) from #5048. Align the shared rebind proof verifier with §3.4: an expired challenge returns ChallengeExpired without consuming it, matching the ceremony path. Add a repeated-expiry regression test.

Follow-ups from the audit: #5644 tracks bounded retained one-time state; #5643 tracks cancel_rebind failure atomicity.

Closes #5048. #5047 stays open until the phase is merged and verified.

Evidence

  • Before: the rebind verifier consumed an expired challenge, so a repeat returned ChallengeReplay, unlike the ceremony path.
  • After: repeated expired rebind attempts return ChallengeExpired without mutation.
  • nix develop ./pkgs/id --command cargo test -p id --manifest-path pkgs/id/Cargo.toml --lib hosted_binding — pass (31 passed, 0 failed).
  • PR CI is pending.

Merge Danger

Door: two-way; the expiry behavior correction and documentation can be reverted.

Blast Radius: low — one in-memory challenge state transition and its module documentation/test.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Bug Fixes
    • Expired challenge attempts no longer alter challenge state. Retrying a delayed rebind with the same expired challenge consistently reports that the challenge has expired.
    • Clarified that an expired challenge does not change state, while other proof-verification outcomes may still consume it.

@dezren39
dezren39 requested a review from a team as a code owner November 4, 2026 20:03
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T20:05:36.630053Z 41c7459 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds a lifecycle transition table and audit findings to the hosted-binding documentation. Expired challenges no longer change state in verify_challenge_proof, and a regression test checks repeated delayed-rebind attempts.

Changes: Hosted binding lifecycle

Layer / File(s) Summary
Lifecycle contract and expired-challenge handling
pkgs/id/src/hosted_binding.rs
The module documents service transitions and audit findings. The ChallengeExpired documentation now states that expiry leaves state unchanged. A regression test checks that repeated delayed-rebind attempts with the same expired challenge return ChallengeExpired.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • Issue 4869: The change updates expired-challenge handling and tests repeated expiry, but the supplied context notes that the submit_proof expiry branch is not changed in this diff.
  • Issue 5047: The lifecycle transition table and expiry semantics document parts of the design epic’s lifecycle contract.
  • Issue 5103: The table records the existing pending-target reservation checks, but the diff does not change their implementation.
  • Issue 5644: The audit records unbounded retention of expired challenges and pairing codes; it does not implement a retention policy.
Merge Risk: Minimal · up to 41c74

No actionable merge-blocking risk is established for the expiry-handling change. Merge readiness remains subject to normal checks and pending CI.

Pre-merge checks: Passed 3 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check Inconclusive Linked issue #5048 is direct and open. Its coding requirements are: (1) a transition table in the module header beside the §3.4 prose, covering every public HostedBindingService method; (2) dispositio… Provide the CeremonyError doc text at reviewed head from pkgs/id/src/hosted_binding.rs and confirm it states the same expiry and consumption semantics as the header and RebindError docs. Confirm that the set of public HostedBindingService m…
Passed Passed checks: 3 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(id): document lifecycle and align rebind expiry" matches the main changes. The diff adds a lifecycle transition table and dispositions to the hosted_binding module header. It also chang…
Out of Scope Changes check Passed The whole-PR diff against merge base 8e9acf3 touches only pkgs/id/src/hosted_binding.rs. Each hunk maps to #5048:
1. Module-header lifecycle table and notes (a)–(d): r…
Full details: Title check

Explanation

The title "fix(id): document lifecycle and align rebind expiry" matches the main changes. The diff adds a lifecycle transition table and dispositions to the hosted_binding module header. It also changes verify_challenge_proof so an expired challenge is not consumed, which matches submit_proof. The title names both the documentation work and the behavioral fix. It omits the new regression test, which is expected for a title.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against merge base 8e9acf3 touches only pkgs/id/src/hosted_binding.rs. Each hunk maps to #5048:

  1. Module-header lifecycle table and notes (a)–(d): required by #5048.
  2. RebindError::ChallengeExpired doc: required by the #5048 header/RebindError agreement criterion.
  3. verify_challenge_proof expiry branch and doc no longer consume the challenge: the expiry alignment that the PR summary and #5048 describe.
  4. expired_rebind_challenge_is_not_recorded_as_consumed test: supports hunk 3.

No unrelated code, file, or declaration change appears in the diff. The raw summary reports no changes to public declarations. The PR description's merge-danger and CI sections are not code changes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Full details: Linked Issues check

Explanation

Linked issue #5048 is direct and open. Its coding requirements are: (1) a transition table in the module header beside the §3.4 prose, covering every public HostedBindingService method; (2) dispositions (a)–(d) recorded in the table or its notes; (3) the header, CeremonyError docs, and RebindError docs agree on expiry and consumption; (4) hosted_binding tests pass.

Evidence met:

  • Req 1 and 2: The diff to pkgs/id/src/hosted_binding.rs adds a lifecycle table after the §3.4 prose. Rows cover new, with_seed, set_now_override, service_id, service_public_key, signup_account, account, request_challenge, canonical_transcript, submit_proof, complete_browser_ceremony, create_pairing_code, exchange_pairing_code, request_delayed_rebind, cancel_rebind, rebind_with_old_key_authorization, effect_due_rebind, and read-only or private helpers. Dispositions (a) pairing codes, (b) consumed_challenges growth, (c) reservation scan cost, and (d) old-key symmetry each appear as notes with a stated outcome. Items (a) and (b) defer pruning to #5644.
  • Req 3, partial: verify_challenge_proof no longer calls consume() on expiry. Its doc and the RebindError::ChallengeExpired doc both state that expiry changes no state.
  • Req 4: The PR reports 31 passed and 0 failed for the hosted_binding filter. This is the author's report. The reviewer did not run the test. PR CI is pending.
  • New test expired_rebind_challenge_is_not_recorded_as_consumed issues two repeated expired requests and asserts ChallengeExpired on both.

Unresolved:

  • The CeremonyError docs are not changed by the diff. Their wording was not read, so agreement with the header and RebindError wording is not confirmed.
  • The full set of public HostedBindingService methods at head was not enumerated. The file exceeds the read limit, so table completeness is not confirmed.
  • Closing #4868, #4871, and #4887 with evidence comments is issue administration, not a coding requirement. It is excluded from this assessment.

Resolution

Provide the CeremonyError doc text at reviewed head from pkgs/id/src/hosted_binding.rs and confirm it states the same expiry and consumption semantics as the header and RebindError docs. Confirm that the set of public HostedBindingService methods at reviewed head matches the table rows. Confirm the hosted_binding test result at reviewed head once CI completes.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Clippy (1.99.0)

Clippy execution timed out

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 95159ee1-bdbc-4b1b-a8ea-331916287725
Commits

Reviewing files that changed from the base of the PR and between 8e9acf3 and 41c7459.

Files selected for processing: 1
  • pkgs/id/src/hosted_binding.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id(hosted_binding): closing lifecycle audit — transition table for every public method + module-header contract statement (Phase 4 of #5047)

1 participant